package org.jsola.hr.provider.impl;

import lombok.extern.slf4j.Slf4j;
import org.jsola.config.entity.SiteConfigDO;
import org.jsola.config.service.ISiteConfigService;
import org.jsola.hr.provider.ISiteConfigProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wcl
 */
@Slf4j
@Service("hrISiteConfigProviderServiceImpl")
public class SiteConfigProviderServiceImpl implements ISiteConfigProviderService {

    @Autowired
    private ISiteConfigService siteConfigService;

    @Override
    public SiteConfigDO selectByCode(String code, String tenantId) {
        return siteConfigService.selectByCode(code, tenantId);
    }

    @Override
    public String selectValueByCode(String code, String tenantId) {
        log.info("查询开发参数配置,   租户:{},   code:{}", tenantId, code);
        SiteConfigDO siteConfigDO = siteConfigService.selectByCode(code, tenantId);
        if (null == siteConfigDO) {
            log.error("系统参数为空:租户:{},code:{}", tenantId, code);
            return null;
        }
        return siteConfigDO.getValue();
    }
}
